package com.yenroc.invoice.annotations;

import java.lang.annotation.*;

/**
 * @author heyanpeng
 * @date 2024年06月28日 15:24
 */
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.TYPE, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface Schema {
    Class<?> implementation() default Void.class;

    Class<?> not() default Void.class;

    Class<?>[] oneOf() default {};

    Class<?>[] anyOf() default {};

    Class<?>[] allOf() default {};

    String name() default "";

    String title() default "";

    double multipleOf() default 0.0;

    String maximum() default "";

    boolean exclusiveMaximum() default false;

    String minimum() default "";

    boolean exclusiveMinimum() default false;

    int maxLength() default Integer.MAX_VALUE;

    int minLength() default 0;

    String pattern() default "";

    int maxProperties() default 0;

    int minProperties() default 0;

    String[] requiredProperties() default {};

    /** @deprecated */
    @Deprecated
    boolean required() default false;

    RequiredMode requiredMode() default Schema.RequiredMode.AUTO;

    String description() default "";

    String format() default "";

    String ref() default "";

    boolean nullable() default false;

    /** @deprecated */
    @Deprecated
    boolean readOnly() default false;

    /** @deprecated */
    @Deprecated
    boolean writeOnly() default false;

    AccessMode accessMode() default Schema.AccessMode.AUTO;

    String example() default "";


    boolean deprecated() default false;

    String type() default "";

    String[] allowableValues() default {};

    String defaultValue() default "";

    String discriminatorProperty() default "";

    boolean hidden() default false;

    boolean enumAsRef() default false;

    Class<?>[] subTypes() default {};

    AdditionalPropertiesValue additionalProperties() default Schema.AdditionalPropertiesValue.USE_ADDITIONAL_PROPERTIES_ANNOTATION;

    public static enum RequiredMode {
        AUTO,
        REQUIRED,
        NOT_REQUIRED;

        private RequiredMode() {
        }
    }

    public static enum AdditionalPropertiesValue {
        TRUE,
        FALSE,
        USE_ADDITIONAL_PROPERTIES_ANNOTATION;

        private AdditionalPropertiesValue() {
        }
    }

    public static enum AccessMode {
        AUTO,
        READ_ONLY,
        WRITE_ONLY,
        READ_WRITE;

        private AccessMode() {
        }
    }
}
